<?php

namespace app\index\model;

use think\Model;
use traits\model\SoftDelete;

class Banner extends Model
{
    use SoftDelete;
    protected $deleteTime = "deletetime";

    public function getImageAttr($value)
    {
        return $value ? 'https://gzrstech.oss-cn-guangzhou.aliyuncs.com'.$value : 'https://gzrstech.oss-cn-guangzhou.aliyuncs.com/uploads/20210122/9c2cb54d989e366329d68d595715daaf.png';
    }

    public static function getBanners()
    {
        return self::where('onlineswitch', 1)->order('weigh desc')->select();
    }
}
